package com.ymatou.authapp.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.authapp.parameter.UserBillsExistsRequestDtoBean;
import com.ymatou.authapp.service.UserBillsExistsRequestDtoCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P2;
import com.ymt.utils.tag.P3;
/**
*查询用户凭据是否被非当前用户使用接口
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_UserBillsExistsRequestDto{
	private static UserBillsExistsRequestDtoBean userbillsexistsrequestdtoBean;
	private static UserBillsExistsRequestDtoCall userbillsexistsrequestdtoCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("查询用户凭据是否被非当前用户使用接口");
	}

	@Before
	public void caseUp() {
		userbillsexistsrequestdtoBean=new UserBillsExistsRequestDtoBean();
		userbillsexistsrequestdtoCall=new UserBillsExistsRequestDtoCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(userbillsexistsrequestdtoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserBillsExistsRequestDto_001() {
		Logger.start(true,"用户凭据（LoginId, Email, Mobile）被非当前用户使用");
		try {
			userbillsexistsrequestdtoBean.setLoginId("muse");
			userbillsexistsrequestdtoBean.setUserId(101);
			userbillsexistsrequestdtoBean.setEMail("daq63@ymatou.com");
			userbillsexistsrequestdtoBean.setMobile("13850367490");
			userbillsexistsrequestdtoBean.setASource("app source");
			userbillsexistsrequestdtoBean.setClientIp("120.12.10.12");
			userbillsexistsrequestdtoBean.setCSource("Channel source");
			userbillsexistsrequestdtoBean.setTSource("Terminal source");
			userbillsexistsrequestdtoCall.setData(userbillsexistsrequestdtoBean);
			userbillsexistsrequestdtoCall.callService();			
			
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getSuccess(), "验证查询成功");
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getResult().get("LoginIdExists"), "验证登陆ID凭证被当前用户使用");
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getResult().get("EMailExists"), "验证邮箱凭证被当前用户使用");
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getResult().get("MobileExists"), "验证手机凭证被当前用户使用");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserBillsExistsRequestDto_002() {
		Logger.start(false,"用户凭据（LoginId, Email, Mobile）被当前用户使用");
		try {
			userbillsexistsrequestdtoBean.setLoginId("muse");
			userbillsexistsrequestdtoBean.setUserId(100);
			userbillsexistsrequestdtoBean.setEMail("daq63@ymatou.com");
			userbillsexistsrequestdtoBean.setMobile("13850367490");
			userbillsexistsrequestdtoBean.setASource("app source");
			userbillsexistsrequestdtoBean.setClientIp("120.12.10.12");
			userbillsexistsrequestdtoBean.setCSource("Channel source");
			userbillsexistsrequestdtoBean.setTSource("Terminal source");
			userbillsexistsrequestdtoCall.setData(userbillsexistsrequestdtoBean);
			userbillsexistsrequestdtoCall.callService();			
			
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getSuccess(), "验证查询成功");
			Logger.verifyEquals(false, userbillsexistsrequestdtoCall.getResult().get("LoginIdExists"), "验证登陆ID凭证被当前用户使用");
			Logger.verifyEquals(false, userbillsexistsrequestdtoCall.getResult().get("EMailExists"), "验证邮箱凭证被当前用户使用");
			Logger.verifyEquals(false, userbillsexistsrequestdtoCall.getResult().get("MobileExists"), "验证手机凭证被当前用户使用");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserBillsExistsRequestDto_003() {
		Logger.start(true,"不输入LoginId,则LoginId凭证不做判断，默认返回false");
		try {
			userbillsexistsrequestdtoBean.setUserId(102);
			userbillsexistsrequestdtoBean.setEMail("daq63@ymatou.com");
			userbillsexistsrequestdtoBean.setMobile("13850367490");
			userbillsexistsrequestdtoBean.setASource("app source");
			userbillsexistsrequestdtoBean.setClientIp("120.12.10.12");
			userbillsexistsrequestdtoBean.setCSource("Channel source");
			userbillsexistsrequestdtoBean.setTSource("Terminal source");
			userbillsexistsrequestdtoCall.setData(userbillsexistsrequestdtoBean);
			userbillsexistsrequestdtoCall.callService();			
			
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getSuccess(), "验证查询成功");
			Logger.verifyEquals(false, userbillsexistsrequestdtoCall.getResult().get("LoginIdExists"), "验证登陆ID凭证");
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getResult().get("EMailExists"), "验证邮箱凭证被非当前用户使用");
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getResult().get("MobileExists"), "验证手机凭证被非当前用户使用");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserBillsExistsRequestDto_004() {
		Logger.start(true,"不输入Mobile，则Mobile凭证不做判断，默认返回false");
		try {
			userbillsexistsrequestdtoBean.setLoginId("muse");
			userbillsexistsrequestdtoBean.setUserId(101);
			userbillsexistsrequestdtoBean.setEMail("daq63@ymatou.com");
			userbillsexistsrequestdtoBean.setASource("app source");
			userbillsexistsrequestdtoBean.setClientIp("120.12.10.12");
			userbillsexistsrequestdtoBean.setCSource("Channel source");
			userbillsexistsrequestdtoBean.setTSource("Terminal source");
			userbillsexistsrequestdtoCall.setData(userbillsexistsrequestdtoBean);
			userbillsexistsrequestdtoCall.callService();			
			
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getSuccess(), "验证查询成功");
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getResult().get("LoginIdExists"), "验证登陆ID凭证被非当前用户使用");
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getResult().get("EMailExists"), "验证邮箱凭证被非当前用户使用");
			Logger.verifyEquals(false, userbillsexistsrequestdtoCall.getResult().get("MobileExists"), "验证手机凭证");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserBillsExistsRequestDto_005() {
		Logger.start(true,"不输入Email,则Email凭证不做判断，默认返回false");
		try {
			userbillsexistsrequestdtoBean.setLoginId("muse");
			userbillsexistsrequestdtoBean.setUserId(102);
			userbillsexistsrequestdtoBean.setMobile("13850367490");
			userbillsexistsrequestdtoBean.setASource("app source");
			userbillsexistsrequestdtoBean.setClientIp("120.12.10.12");
			userbillsexistsrequestdtoBean.setCSource("Channel source");
			userbillsexistsrequestdtoBean.setTSource("Terminal source");
			userbillsexistsrequestdtoCall.setData(userbillsexistsrequestdtoBean);
			userbillsexistsrequestdtoCall.callService();			
			
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getSuccess(), "验证查询成功");
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getResult().get("LoginIdExists"), "验证登陆ID凭证被非当前用户使用");
			Logger.verifyEquals(false, userbillsexistsrequestdtoCall.getResult().get("EMailExists"), "验证邮箱凭证");
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getResult().get("MobileExists"), "验证手机凭证被非当前用户使用");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_UserBillsExistsRequestDto_006() {
		Logger.start(true,"不输入UserId, 所有凭证都被其他用户使用");
		try {
			userbillsexistsrequestdtoBean.setLoginId("muse");
			userbillsexistsrequestdtoBean.setEMail("daq63@ymatou.com");
			userbillsexistsrequestdtoBean.setMobile("13850367490");
			userbillsexistsrequestdtoBean.setASource("app source");
			userbillsexistsrequestdtoBean.setClientIp("120.12.10.12");
			userbillsexistsrequestdtoBean.setCSource("Channel source");
			userbillsexistsrequestdtoBean.setTSource("Terminal source");
			userbillsexistsrequestdtoCall.setData(userbillsexistsrequestdtoBean);
			userbillsexistsrequestdtoCall.callService();			
			
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getSuccess(), "验证查询成功");
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getResult().get("LoginIdExists"), "验证登陆ID凭证被当前用户使用");
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getResult().get("EMailExists"), "验证邮箱凭证被当前用户使用");
			Logger.verifyEquals(true, userbillsexistsrequestdtoCall.getResult().get("MobileExists"), "验证手机凭证被当前用户使用");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}